#include "TutorialState.h"

#include "Game.h"
#include "MainMenuState.h"

void TutorialState::Enter() 
{
	// Getting bitmap font
	GroupFont =	CBitmapFont::GetInstance();

	// Load bitmap font
	FontImageID = CSGD_TextureManager::GetInstance()->LoadTexture(_T("Graphics/Robovox.bmp"), D3DCOLOR_XRGB(0,0,0));

	// Set the bitmap font's values
	GroupFont->SetValues(32, 32, 16, 14, ' ', FontImageID);
}

void TutorialState::Exit() 
{
	// Unload bitmap font
	if(FontImageID != -1)
	{
		CSGD_TextureManager::GetInstance()->UnloadTexture(FontImageID);
		FontImageID = -1;
	}
}

bool TutorialState::Input() 
{
	// If escape return to main menu
	if(CSGD_DirectInput::GetInstance()->KeyPressed(DIK_ESCAPE) || CSGD_DirectInput::GetInstance()->JoystickButtonPressed(6))
		Game::GetInstance()->ChangeState(MainMenuState::GetInstance());

	return true;
}

void TutorialState::Update(float elapsed)
{
}

void TutorialState::Render() 
{
	GroupFont->Print("Controls", 32, 32, 3.0f, D3DCOLOR_ARGB(255,0,255,255));

	GroupFont->Print("Joystick to move.", 140, 150, 1.0f, D3DCOLOR_ARGB(255,0,255,255));
	GroupFont->Print("A to attack.", 140, 250, 1.0f, D3DCOLOR_ARGB(255,0,255,255));
	GroupFont->Print("B to switch weapons.", 140, 350, 1.0f, D3DCOLOR_ARGB(255,0,255,255));
}

TutorialState::TutorialState() 
{
}

TutorialState::TutorialState(TutorialState& menu) 
{
}

TutorialState* TutorialState::GetInstance() 
{
	static TutorialState instance;
	return &instance;
}

TutorialState::~TutorialState()
{
}